package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Config struct {
	Mysql
	Redis
}

type Mysql struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
}
type Redis struct {
	Host     string
	Password string
}

var AppConfig Config

func Init() {
	viper.SetConfigFile("../appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		return
	}
	err = viper.Unmarshal(&AppConfig)
	if err != nil {
		return
	}
	fmt.Println(AppConfig)

}
